home *** CD-ROM | disk | FTP | other *** search
/ Aminet 21 / Aminet 21 (1997)(GTI - Schatztruhe)[!][Oct 1997].iso / Aminet / gfx / show / gs_src_gs.lha / gs5.03 / errors.h < prev    next >
C/C++ Source or Header  |  1997-04-20  |  6KB  |  178 lines

  1. /* Copyright (C) 1989, 1995 Aladdin Enterprises.  All rights reserved.
  2.   
  3.   This file is part of Aladdin Ghostscript.
  4.   
  5.   Aladdin Ghostscript is distributed with NO WARRANTY OF ANY KIND.  No author
  6.   or distributor accepts any responsibility for the consequences of using it,
  7.   or for whether it serves any particular purpose or works at all, unless he
  8.   or she says so in writing.  Refer to the Aladdin Ghostscript Free Public
  9.   License (the "License") for full details.
  10.   
  11.   Every copy of Aladdin Ghostscript must include a copy of the License,
  12.   normally in a plain ASCII text file named PUBLIC.  The License grants you
  13.   the right to copy, modify and redistribute Aladdin Ghostscript, but only
  14.   under certain conditions described in the License.  Among other things, the
  15.   License requires that the copyright notice and this notice be preserved on
  16.   all copies.
  17. */
  18.  
  19. /* errors.h */
  20. /* Definition of error codes */
  21.  
  22. /*
  23.  * A procedure that may return an error always returns
  24.  * a non-negative value (zero, unless otherwise noted) for success,
  25.  * or negative for failure.
  26.  * We use ints rather than an enum to avoid a lot of casting.
  27.  */
  28.  
  29. /*
  30.  * The following peculiar structure allows us to include this file
  31.  * wherever error code definitions are needed, and use the same file
  32.  * to generate the table of error names by setting INCLUDE_ERROR_NAMES.
  33.  */
  34.  
  35. #        ifdef INCLUDE_ERROR_NAMES
  36.  
  37. /* Define the error name table */
  38. const char _ds *gs_error_names[] = {
  39. #define _e_(code,name) name,
  40.  
  41. #        else            /* !INCLUDE_ERROR_NAMES */
  42.  
  43. extern const char _ds *gs_error_names[];
  44. #  define _e_(code,name)
  45.  
  46. #endif                    /* (!)INCLUDE_ERROR_NAMES */
  47.  
  48.         /* ------ PostScript Level 1 errors ------ */
  49.  
  50. #define e_unknownerror (-1)        /* unknown error */
  51.   _e_(e_unknown, "unknownerror")
  52. #define e_dictfull (-2)
  53.   _e_(e_dictfull, "dictfull")
  54. #define e_dictstackoverflow (-3)
  55.   _e_(e_dictstackoverflow, "dictstackoverflow")
  56. #define e_dictstackunderflow (-4)
  57.   _e_(e_dictstackunderflow, "dictstackunderflow")
  58. #define e_execstackoverflow (-5)
  59.   _e_(e_execstackoverflow, "execstackoverflow")
  60. #define e_interrupt (-6)
  61. /* We also need to define gs_error_interrupt, for gpcheck.h. */
  62. #undef gs_error_interrupt
  63. #define gs_error_interrupt e_interrupt
  64.   _e_(e_interrupt, "interrupt")
  65. #define e_invalidaccess (-7)
  66.   _e_(e_invalidaccess, "invalidaccess")
  67. #define e_invalidexit (-8)
  68.   _e_(e_invalidexit, "invalidexit")
  69. #define e_invalidfileaccess (-9)
  70.   _e_(e_invalidfileaccess, "invalidfileaccess")
  71. #define e_invalidfont (-10)
  72.   _e_(e_invalidfont, "invalidfont")
  73. #define e_invalidrestore (-11)
  74.   _e_(e_invalidrestore, "invalidrestore")
  75. #define e_ioerror (-12)
  76.   _e_(e_ioerror, "ioerror")
  77. #define e_limitcheck (-13)
  78.   _e_(e_limitcheck, "limitcheck")
  79. #define e_nocurrentpoint (-14)
  80.   _e_(e_nocurrentpoint, "nocurrentpoint")
  81. #define e_rangecheck (-15)
  82.   _e_(e_rangecheck, "rangecheck")
  83. #define e_stackoverflow (-16)
  84.   _e_(e_stackoverflow, "stackoverflow")
  85. #define e_stackunderflow (-17)
  86.   _e_(e_stackunderflow, "stackunderflow")
  87. #define e_syntaxerror (-18)
  88.   _e_(e_syntaxerror, "syntaxerror")
  89. #define e_timeout (-19)
  90.   _e_(e_timeout, "timeout")
  91. #define e_typecheck (-20)
  92.   _e_(e_typecheck, "typecheck")
  93. #define e_undefined (-21)
  94.   _e_(e_undefined, "undefined")
  95. #define e_undefinedfilename (-22)
  96.   _e_(e_undefinedfilename, "undefinedfilename")
  97. #define e_undefinedresult (-23)
  98.   _e_(e_undefinedresult, "undefinedresult")
  99. #define e_unmatchedmark (-24)
  100.   _e_(e_unmatchedmark, "unmatchedmark")
  101. #define e_VMerror (-25)
  102.   _e_(e_VMerror, "VMerror")
  103.  
  104.         /* ------ Additional Level 2 and DPS errors ------ */
  105.  
  106. #define e_configurationerror (-26)
  107.   _e_(e_configurationerror, "configurationerror")
  108. #define e_invalidcontext (-27)
  109.   _e_(e_invalidcontext, "invalidcontext")
  110. #define e_undefinedresource (-28)
  111.   _e_(e_undefinedresource, "undefinedresource")
  112. #define e_unregistered (-29)
  113.   _e_(e_unregistered, "unregistered")
  114. /* invalidid is for the NeXT DPS extension. */
  115. #define e_invalidid (-30)
  116.   _e_(e_invalidid, "invalidid")
  117.  
  118. #        ifdef INCLUDE_ERROR_NAMES
  119.  
  120. /* End of error name table */
  121.   0
  122. };
  123.  
  124. #        endif            /* INCLUDE_ERROR_NAMES */
  125.  
  126.         /* ------ Pseudo-errors used internally ------ */
  127.  
  128. /*
  129.  * Internal code for a fatal error.
  130.  * gs_interpret also returns this for a .quit with a positive exit code.
  131.  */
  132. #define e_Fatal (-100)
  133.  
  134. /*
  135.  * Internal code for the .quit operator.
  136.  * The real quit code is an integer on the operand stack.
  137.  * gs_interpret returns this only for a .quit with a zero exit code.
  138.  */
  139. #define e_Quit (-101)
  140.  
  141. /*
  142.  * Internal code for a normal exit from the interpreter.
  143.  * Do not use outside of interp.c.
  144.  */
  145. #define e_InterpreterExit (-102)
  146.  
  147. /*
  148.  * Internal code that indicates that a procedure has been inserted
  149.  * on the e-stack at (former) esp+2, to be executed before retrying
  150.  * the current token.  This is used for color remapping
  151.  * involving a call back into the interpreter -- inelegant, but effective.
  152.  */
  153. #define e_InsertProc (-103)
  154.  
  155. /*
  156.  * Internal code to indicate we have underflowed the top block
  157.  * of the e-stack.
  158.  */
  159. #define e_ExecStackUnderflow (-104)
  160.  
  161. /*
  162.  * Internal code for the vmreclaim operator with a positive operand.
  163.  * We need to handle this as an error because otherwise the interpreter
  164.  * won't reload enough of its state when the operator returns.
  165.  */
  166. #define e_VMreclaim (-105)
  167.  
  168. /*
  169.  * Internal code for requesting more input from run_string.
  170.  */
  171. #define e_NeedInput (-106)
  172.  
  173. /*
  174.  * Define which error codes require re-executing the current object.
  175.  */
  176. #define error_is_interrupt(ecode)\
  177.   ((ecode) == e_interrupt || (ecode) == e_timeout)
  178.